<template>
	<div style="background-color: white;padding-top: 20px;">
		<div class="headercon">
			<el-form class="cardboxList_box" ref="form" :model="form" label-width="100px">
				
				<el-row :gutter="20" class="mb8">
					<el-col :span="6" style="width: 240px;">
						<div class="grid-content bg-purple">
							<el-form-item label="关键词搜索">
								<el-input style="width: 150px;" v-model="form.search" placeholder="" />
							</el-form-item>
						</div>
					</el-col>
					<el-col :span="6" style="width: 362px;">
						<div class="grid-content bg-purple">
							<el-form-item label="年份">
								 <el-date-picker
								      format="yyyy" 
									  value-format="yyyy"
								      v-model="form.year"
								      type="year"
									  @change="yearChange"
								      placeholder="选择年">
								    </el-date-picker>
							</el-form-item>
						</div>
					</el-col>
					<el-col :span="1.5">
						<div class="grid-content bg-purple" style="margin-top: -10px;margin-left: 33px;">
							<el-button type="primary" icon="el-icon-search" @click="getList">搜索</el-button>
						</div>
					</el-col>
					<el-col :span="1.5">
						<div class="grid-content bg-purple" style="margin-top: -10px;margin-left: 20px;">
							<el-button type="primary" icon="el-icon-search" @click="restSearch">重置</el-button>
						</div>
					</el-col>
					<el-col :span="1.5">
						<div class="grid-content bg-purple" style="margin-top: -10px;margin-left: 20px;">
							<el-button type="primary" icon="el-icon-search" @click="export_excel_userList">导出
							</el-button>
						</div>
					</el-col>
					<!-- <el-col :span="1.5" >
						<div class="grid-content bg-purple" style="margin-top: -10px;margin-left: 20px;">
							<el-button icon="el-icon-plus" type="primary" @click="showdialogVisible">新增</el-button>
						</div>
					</el-col> -->
				</el-row>
				<div style="margin-left: 20px;margin-top: 20px;">

					<!-- <el-col :span="1.5">
						<div class="grid-content bg-purple" style="margin-top: -10px;margin-left: 20px;">
							<el-button type="primary" icon="el-icon-search" @click="deleteList">批量删除</el-button>
						</div>
					</el-col>
					<el-col :span="1.5">
						<div class="grid-content bg-purple" style="margin-top: -10px;margin-left: 20px;">
							<el-button type="primary" icon="el-icon-search" @click="export_excel_userList">导出
							</el-button>
						</div>
					</el-col> -->

				</div>
			</el-form>
			<!-- <el-button type="primary" @click="showdialogVisible">新增</el-button> -->
		</div>
	
		<el-table :data="tableData" stripe ref="multipleTable" :row-key="getRowKeys" @selection-change="handleChange">
			<!-- <el-table-column type="selection" :reserve-selection="true"></el-table-column> -->
			<!-- <el-table-column prop="realname" label="头像">
				<template slot-scope="scope">
					<el-image style="width: 60px;height: 60px;" class="table-td-thumb" :src="scope.row.head_img"
						:preview-src-list="[scope.row.head_img]"></el-image>
				</template>
			</el-table-column> -->
		
			<el-table-column type="index" prop="realname" label="序号" width="60px" align="center">
			</el-table-column>
			<el-table-column prop="xingming" label="姓名" align="center">
			</el-table-column>
			<el-table-column prop="tel" label="电话" align="center"></el-table-column>
			<!-- <el-table-column prop="open_id" label="open_id" align="center"></el-table-column> -->
			<el-table-column prop="nahuozongjin_e" label="拿货总金额" align="center">
				<template slot-scope="scope">
					 <div style="color: red;cursor: pointer;" @click="edictPrice(scope.row)">{{ scope.row.nahuozongjin_e }}</div>
				 </template>
			</el-table-column>
			<el-table-column prop="kehufandianjin_e" label="客户返点金额" align="center"></el-table-column>
			<el-table-column prop="kehufandianbili" label="客户返点比例" align="center"></el-table-column>
			<el-table-column prop="xiaoshouxingming" label="销售姓名" align="center"></el-table-column>
			<el-table-column prop="jieshaorenxingming" label="介绍人姓名" align="center"></el-table-column>
			<el-table-column prop="jieshaorenfandianjin_e" label="介绍人返点金额" align="center"></el-table-column>
			<el-table-column prop="jieshaorenfandianbili" label="介绍人返点比例" align="center"></el-table-column>
			<el-table-column prop="create_time" label="创建时间" align="center">
			</el-table-column>
			<el-table-column fixed="right" label="操作" width="120">
				<template slot-scope="scope">
					<el-button @click="handleClick(scope.row,false)" type="primary" style="background: rgba(0,111,188,0.5);border: 0;" size="small">编辑</el-button>
					<!-- <el-button class="delete" type="danger" style="color: #fff;" @click="deleteThis(scope.row)" size="small">删除</el-button> -->

				</template>
			</el-table-column>
		</el-table>
		<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
			:page-sizes="[30]" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper"
			:total="pageTotal">
		</el-pagination>


		<el-dialog :title="Texttitle" :visible.sync="dialogVisible" width="1000px">
			<el-form class="cardboxList_box">
				<el-row :gutter="60">
					<el-col :span="20">
						<el-form-item label="姓名" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.xingming" type="text"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="电话" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.tel" type="text" readonly></el-input>
						</el-form-item>
					</el-col>
					<!-- <el-col :span="20">
						<el-form-item label="open_id" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.open_id" type="text" readonly></el-input>
						</el-form-item>
					</el-col> -->
				
					<el-col :span="20">
						<el-form-item label="客户返点金额" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.kehufandianjin_e" type="text" readonly></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="客户返点比例" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.kehufandianbili" type="text" readonly></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="销售姓名" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.xiaoshouxingming" type="text"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="介绍人姓名" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.jieshaorenxingming" type="text"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="介绍人返点金额" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.jieshaorenfandianjin_e" type="text" readonly></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="介绍人返点比例" label-width="130px">
							<el-input style="width: 100%;" v-model="addform.jieshaorenfandianbili" type="text" readonly></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20">
						<el-form-item label="本年度拿货总金额" label-width="130px">
							<el-input style="width: 50%;" v-model="addform.nahuozongjin_e" type="text" readonly></el-input>
							<!-- <el-button type="primary" icon="el-icon-search" @click="nahuozongjin_e_cut" style="margin-left: 20px;">减少</el-button>
							<el-button type="primary" icon="el-icon-search" @click="nahuozongjin_e_add">增加</el-button> -->
						</el-form-item>
					</el-col>
					<!-- <el-col :span="20" v-if="add_cut_flag == 2">
						<el-form-item label="增加金额" label-width="130px">
							<el-input style="width: 100%;" v-model="add_price" type="text"></el-input>
						</el-form-item>
					</el-col>
					<el-col :span="20" v-if="add_cut_flag == 1">
						<el-form-item label="减少金额" label-width="130px">
							<el-input style="width: 100%;" v-model="cut_price" type="text"></el-input>
						</el-form-item>
					</el-col> -->
					<!-- <el-col :span="20">
						<el-form-item label="内容" label-width="100px">
							<quill-editor ref="myTextEditor" v-model="addform.text" :options="editorOption"></quill-editor>
						</el-form-item>
					</el-col> -->
					
				</el-row>

			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitForm_add" size="small">确定</el-button>
				<el-button @click="logCancel_1" size="small">取消</el-button>
			</div>
		</el-dialog>
       
	   <el-dialog title="金额修改" :visible.sync="dialogVisible_1" width="1000px">
	   		   <el-form class="cardboxList_box">
	   		   	<el-row :gutter="60">
	   		   		<el-col :span="20">
	   		   			<el-form-item label="客户返点比例" label-width="130px">
	   		   				<el-input style="width: 100%;" v-model="addform.kehufandianbili" type="text" readonly></el-input>
	   		   			</el-form-item>
	   		   		</el-col>
	   		   		<el-col :span="20">
	   		   			<el-form-item label="介绍人返点比例" label-width="130px">
	   		   				<el-input style="width: 100%;" v-model="addform.jieshaorenfandianbili" type="text" readonly></el-input>
	   		   			</el-form-item>
	   		   		</el-col>
	   		   		<el-col :span="20">
	   		   			<el-form-item label="本年度拿货总金额" label-width="130px">
	   		   				<el-input style="width: 50%;" v-model="addform.nahuozongjin_e" type="text" readonly></el-input>
	   		   				<el-button type="primary" icon="el-icon-search" @click="nahuozongjin_e_cut" style="margin-left: 20px;">减少</el-button>
	   		   				<el-button type="primary" icon="el-icon-search" @click="nahuozongjin_e_add">增加</el-button>
	   		   			</el-form-item>
	   		   		</el-col>
	   		   		<el-col :span="20" v-if="add_cut_flag == 2">
	   		   			<el-form-item label="增加金额" label-width="130px">
	   		   				<el-input style="width: 100%;" v-model="add_price" type="text"></el-input>
	   		   			</el-form-item>
	   		   		</el-col>
	   		   		<el-col :span="20" v-if="add_cut_flag == 1">
	   		   			<el-form-item label="减少金额" label-width="130px">
	   		   				<el-input style="width: 100%;" v-model="cut_price" type="text"></el-input>
	   		   			</el-form-item>
	   		   		</el-col>
	   		   		
	   		   	</el-row>
	   		   
	   		   </el-form>
	   		   <div slot="footer" class="dialog-footer">
	   		   	<el-button type="primary" @click="submitForm_add_1" size="small">确定</el-button>
	   		   	<el-button @click="logCancel_2" size="small">取消</el-button>
	   		   </div>
	   		   
	   		</el-dialog>



	</div>
</template>

<script>
	import 'quill/dist/quill.core.css';
	import 'quill/dist/quill.snow.css';
	import 'quill/dist/quill.bubble.css';
	import { quillEditor,Quill } from 'vue-quill-editor';
	import {container, ImageExtend, QuillWatch} from 'quill-image-extend-module'
	  Quill.register('modules/ImageExtend', ImageExtend)
	// import {
	// 	quillEditor
	// } from 'vue-quill-editor';
	// 富文本编辑器工具栏配置，因为涉及到富文本编辑器以外的组件调用，所以在这里我们需要重新自定义一下富文本编辑器的工具栏
	const toolbarOptions = [
		['bold', 'italic', 'underline', 'strike'], // toggled buttons
		['blockquote', 'code-block'],
	
		[{
			header: 1
		}, {
			header: 2
		}], // custom button values
		[{
			list: 'ordered'
		}, {
			list: 'bullet'
		}],
		[{
			script: 'sub'
		}, {
			script: 'super'
		}], // superscript/subscript
		[{
			indent: '-1'
		}, {
			indent: '+1'
		}], // outdent/indent
		[{
			direction: 'rtl'
		}], // text direction
	
		[{
			size: ['small', false, 'large', 'huge']
		}], // custom dropdown
		[{
			header: [1, 2, 3, 4, 5, 6, false]
		}],
	
		[{
			color: []
		}, {
			background: []
		}], // dropdown with defaults from theme
		[{
			font: []
		}],
		[{
			align: []
		}],
		['link', 'image', 'video'],
		['clean'] // remove formatting button
	]
	import {
		proUrl,
		uploadImg,
		// userviewOption,
		userList,
		userAdd,
		userEdict,
		userDelete,
		user_export_excel,
		update_nahuo

	} from '../../api/index';
	export default {
		name: 'dashboard',
		data() {
			return {
				add_cut_flag:-1,
				add_price:'',
				cut_price:'',
				userInfo:'',
				now_mungbean:0,
				allPrice:0,
				subFormNum:0,
				addpriceType:'减',
				userList_1:[],
				readOnly:false,
				defaultData:[],
				screenOptions: '',
				statistical: '', //统计
				uploadImgUrl: 'https://www.room3.liaoningxiaofangjiuyuan.cn/backstage/api/upload_image/',
				fileList: [],
				fileList1: [],
				Look_dataList: [],
				selectionbox: '',
				roleOptions: [],
				defaultProps: {
				          children: 'children',
				          label: 'label'
				        },
				
				templateVisible: false,
				showViewer: false, // 显示查看器
				ruleForm: '',
				hideUp: '',
				nextProjectForm: {
					publicWelfareUrl: "",
				},
				Texttitle: "新增",
				page: 1,
				page_1: 1,
				form: {
					page: 1,
					size: 30,
					username: undefined,
                    name:undefined
				},
				addform: {
					rolename: undefined, //
					jurisdiction_ids:[]
				},
				// 富文本编辑器工具栏
				editorOption: {
				        modules: {
				          ImageExtend: {
				            loading: true,
				            name: "image",
				            size: 10000,
				            action: "https://www.nxain.com/backstage/api/upload_image/",
				            response: res => {
								console.log(res)
				              return res.url;
				            },
				            headers: (xhr,formData) => {
				              //xhr.setRequestHeader(
				              //  "X-Nideshop-Token",
				              //  localStorage.getItem("token")
				              //);
				            }, // 可选参数 设置请求头部
				            sizeError: () => {
				              // return this.$message.error("图片超过20");
				            } // 图片超过大小的回调
				          },
				          toolbar: {
				            container: [
				              ["bold", "italic", "underline", "strike"], // 加粗，斜体，下划线，删除线
				              ["blockquote", "code-block"], //引用，代码块
				              [{ header: 1 }, { header: 2 }], // 几级标题
				              [{ list: "ordered" }, { list: "bullet" }], // 有序列表，无序列表
				              [{ script: "sub" }, { script: "super" }], // 下角标，上角标
				              [{ indent: "-1" }, { indent: "+1" }], // 缩进
				              [{ direction: "rtl" }], // 文字输入方向
				              [{ size: ["small", false, "large", "huge"] }], // 字体大小
				              [{ header: [1, 2, 3, 4, 5, 6, false] }], // 标题
				              [{ color: [] }, { background: [] }], // 颜色选择
				              [{ font: [] }], // 字体
				              [{ align: [] }], // 居中
				              ["link", "image"],
				              ["clean"]
				            ],
				            handlers: {
				              image: function() {
				                QuillWatch.emit(this.quill.id);
				              }
				            }
				          }
				        }
				      },
				screenOptions: '',
				statistical: '', //统计
				uploadImgUrl: 'https://www.nxain.com/backstage/api/upload_image/',
				
				childrow: '',
				childtypeflag: 1, //  1新增 2修改
				currentPage: 1, //初始页
				pagesize: 30, //  每页的数据
				pageTotal: '',

				currentPage_1: 1, //初始页
				pagesize_1: 30, //    每页的数据
				pageTotal_1: '',

				currentPage_2: 1, //初始页
				pagesize_2: 30, //    每页的数据
				pageTotal_2: '',

				dialogVisible: false,
				tableData: [],
				tableData_1: [],
				tableData_2: [],

				formitnanme: '',
				flagtype: 1,
				user_id: '',
				//详情
				dialogVisible_1: false,
				detailDataLog: '',
				detailrow: '',

				//添加记录
				addLogVisible: false,
				logInfo: '',
				value2: '',
				pickerOptions: {
					shortcuts: [{
						text: '今天',
						onClick(picker) {
							picker.$emit('pick', new Date());
						}
					}, {
						text: '昨天',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() - 3600 * 1000 * 24);
							picker.$emit('pick', date);
						}
					}, {
						text: '一周前',
						onClick(picker) {
							const date = new Date();
							date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
							picker.$emit('pick', date);
						}
					}]
				},
				templateUser_id: '',

				deleteList_data: ''
			}
		},
		components: {
			quillEditor
		},
		watch: {
			// add_price (newName, oldName) {
			// 	this.addform.nahuozongjin_e = Number(this.addform.nahuozongjin_e) + Number(newName)
				
			// },
			// cut_price(newName, oldName){
			// 	this.addform.nahuozongjin_e = Number(this.addform.nahuozongjin_e) - Number(newName)
			// }
		},
		computed: {
			role() {
				return this.name === 'admin' ? '超级管理员' : '普通用户';
			}
		},
		created() {
			// this.form.user_id=window.localStorage.getItem('user_id')
			// this.yearValue = new Date().getFullYear().toString();
			this.$set(this.form, "year", new Date().getFullYear().toString())
			// console.log(666,this.form.year)
			this.getList()


		},
		// activated() {
		//     this.handleListener();
		// },
		// deactivated() {
		//     window.removeEventListener('resize', this.renderChart);
		//     bus.$off('collapse', this.handleBus);
		// },
		methods: {
			
			yearChange(e){
				console.log(e)
			},
			
			nahuozongjin_e_cut(){
				this.add_cut_flag = 1
				this.cut_price = 0
				this.add_price = 0
			},
			nahuozongjin_e_add(){
				this.add_cut_flag = 2
				this.cut_price = 0
				this.add_price = 0
			},
			
			handleCheckChange() {
				
				let arr=[]
				for(var i=0;i<this.$refs.tree.getCheckedNodes().length;i++){
					arr.push(this.$refs.tree.getCheckedNodes()[i].id)
				}
				this.addform.jurisdiction_ids=arr.toString()
				console.log(111,this.addform.jurisdiction_ids)
			   // return this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes())
			},

			// 用户改变事件
			userChange(e) {
				console.log('===',e)
				for(var i= 0;i<this.userList_1.length;i++){
					if(this.userList_1[i].user_id == e){
						this.userInfo=this.userList_1[i]
						this.now_mungbean=this.userList_1[i].mungbean
					}
				}
				
			},

			getRowKeys(row) {
				return row.user_id
			},

			handleChange(selection) {
				console.log(selection)
				this.deleteList_data = selection
			},

			//批量删除
			deleteList() {
				let that = this
				let ids = []
				let arr = this.deleteList_data
				for (var i = 0; i < arr.length; i++) {
					ids.push(arr[i].user_id)
				}
				that.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let parms = {
						ids: ids.toString()
					}
					batch_delete(parms).then(res => {
						console.log("批量删除", res)
						that.dialogVisible = false
						if (res.code == 0) {
							that.$message({
								message: '批量删除成功！',
								type: 'success'
							});
							that.getList()
						}

						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});

				}).catch(() => {
					that.$message({
						type: 'info',
						message: '已取消删除'
					});
				});


			},

			//批量导出
			export_excel_userList() {
				// let that = this
				// let ids = []
				// let arr = this.deleteList_data
				// for (var i = 0; i < arr.length; i++) {
				// 	ids.push(arr[i].user_id)
				// }

				// let parms = {
				// 	ids: ids.toString()
				// }
				let search = this.form.search ? this.form.search : ''
				let year = this.form.year ? this.form.year : ''
				window.location.href = proUrl + '/backstage/api/user/export_excel/?search=' + search + '&year=' + year
					// export_excel_user(parms).then(res => {
				// 	console.log("批量导出", res)
				// 	that.dialogVisible = false
				// 	if (res.code == 0) {
				// 		that.$message({
				// 			message: '批量导出成功！',
				// 			type: 'success'
				// 		});
				// 		that.getList()
				// 	}

				// 	// this.tableData = res.list;
				// 	// this.pageTotal = res.pageTotal || 50;
				// });


			},

			getListCalculationview() {
				let that = this
				let query;
				query = {}
				console.log(query)
				calculationview(query).then(res => {
					console.log("审核", res);
					that.statistical = res
				});
			},
			uploadSectionFile(param) {
				var fileObj = param.file;
				// FormData 对象
				var form = new FormData();
				// 文件对象
				form.append("image", fileObj);
				uploadImg(form).then(res => {
					console.log("上传图片", res)
					this.addform.job_card_img = res.url
					this.$message({
						message: '上传成功！',
						type: 'success'
					});
				});
			},
			handleRemove(file, fileList) {
				this.ruleForm.cardUpImg = "";
				this.imagesUp = [];
				this.hideUp = false;
			},

			uploadSectionFile1(param) {
				var fileObj = param.file;
				// FormData 对象
				var form = new FormData();
				// 文件对象
				form.append("image", fileObj);
				uploadImg(form).then(res => {
					console.log("上传图片", res)
					this.addform.head_img = res.url
					this.$message({
						message: '上传成功！',
						type: 'success'
					});
				});
			},
			handleRemove1(file, fileList) {
				this.ruleForm.cardUpImg = "";
				this.imagesUp = [];
				this.hideUp = false;
			},

			//列表选择导出
			handleSelectionChange(selection) {
				var selectionbox = selection.map(function(car) {
					return car.template_info_id;
				})
				console.log(selectionbox)
				this.selectionbox = selectionbox.toString()
			},
			groupEdict() {
				if (this.selectionbox == '') {
					this.$message.error('请选择模板！');
				} else {
					this.templateVisibledetail_add_1 = true
					this.templatedetailLog = '批量编辑'
					this.templateDetailFlagtype = 3
					this.addform_2 = {
						method: undefined,
						weight_start: undefined,
						weight_end: undefined,
						date_start: undefined,
						date_end: undefined,
						first_weight: undefined,
						continued_weight: undefined,
						template: undefined,
						user: undefined,
					}
				}
			},
			
			//重置
			restSearch() {
				this.form = {
						page: 1,
						size: 30,
						realname: undefined,
						company: undefined,
						nation: undefined,
						marriage_history: undefined,
						education: undefined,
						constellation: undefined,
						sex: undefined,
						age: undefined,
					},

					this.getList()
			},

			//导出
			exportexelBtn() {
				let query = {}
				exportexel(query).then(res => {
					console.log("导出", res)
				});

			},

			dataSearch() {
				this.formatDate(that.value2)
			},
			//添加记录
			showLogdilog(row, type) {
				this.childtypeflag = type
				this.addLogVisible = true
				if (type == 2) {
					this.childrow = row
					this.addformchild = row
					this.uploadimgurl = row.img
				}

			},

			addLogcancel() {
				this.addLogVisible = false
			},

	


			handleSizeChange: function(size) {
				this.pagesize = size;
				this.form.size = size
				console.log(this.pagesize) //每页下拉显示数据
				this.getList()
			},
			handleCurrentChange: function(currentPage) {
				this.currentPage = currentPage;
				console.log(this.currentPage) //点击第几页
				this.form.page = currentPage
				this.getList()
			},
			handleSizeChange_1: function(size) {
				this.pagesize_1 = size;
				this.form1.size = size
				this.templateList(this.templateUser_id)
			},
			handleCurrentChange_1: function(currentPage) {
				this.currentPage_1 = currentPage;
				console.log(this.currentPage_1) //点击第几页
				this.page_1 = currentPage
				this.form1.page = currentPage
				this.templateList(this.templateUser_id)
			},

			handleSizeChange_2: function(size) {
				this.pagesize_2 = size;
				this.form2.size = size
				this.templateDetailClick()
			},
			handleCurrentChange_2: function(currentPage) {
				this.currentPage_2 = currentPage;
				console.log(this.currentPage_2) //点击第几页
				this.page_2 = currentPage
				this.form2.page = currentPage
				this.templateDetailClick()
			},
			showdialogVisible() {
				this.Texttitle = '新增'
				this.addform = {
					realname: undefined,
					company: undefined,
					department: undefined,
					job_card_img: undefined,
					sex: undefined,			
				}
				let that = this
				let query={}
				this.user_id = ''
				this.dialogVisible = true
				this.flagtype = 1
			},


			//s删除
			deleteThis(row) {
				let that = this
				that.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let query = {
						"notice_id": row.notice_id,
					}
					userDelete(row.notice_id, query).then(res => {
						that.dialogVisible = false
						if (res.code == 0) {
							that.$message({
								message: '删除成功！',
								type: 'success'
							});
							that.getList()
						}

						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});
				}).catch(() => {
					that.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
			},
			//编辑
			handleClick(row,readOnly) {
				console.log("编辑", row)
				this.readOnly=readOnly
				if(readOnly==true){
					this.Texttitle = '查看'
				}else{
					this.Texttitle = '编辑'
				}
				this.flagtype = 2
				this.dialogVisible = true
				this.addform = JSON.parse(JSON.stringify(row)) 
                let that = this
				this.user_id = row.user_id
			},
			edictPrice(row){
		
				this.flagtype = 2
				this.dialogVisible_1 = true
				this.addform = JSON.parse(JSON.stringify(row))
				this.user_id = row.user_id
			},


			//关闭新增弹窗
			logCancel_1() {
				this.dialogVisible = false
			},
			logCancel_2() {
				this.dialogVisible_1 = false
			},
			logCancel_3() {
				this.templateVisibledetail_add_1 = false
			},
			
			submitForm_add_1(){
				let that = this
				if(that.add_cut_flag <= -1){
					this.$message.error('请选择减少或增加类型')
					return false
				}
				that.$confirm('是否确认修改拿货总金额, 是否继续?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					let price = 0
					if(that.add_cut_flag==1){
						price = that.cut_price
					}else{
						price = that.add_price
					}
					let query={
						user_id:that.addform.user_id,
						ctypes:that.add_cut_flag==1?0:1,
						input_price:price,
						ori_price:that.addform.nahuozongjin_e,
						kehufandianbili:that.addform.kehufandianbili,
					    jieshaorenfandianbili:that.addform.jieshaorenfandianbili,
					}
					update_nahuo(query).then(res1 => {
					    that.dialogVisible_1 = false
						that.cut_price = 0
						that.add_price = 0
						that.add_cut_flag = -1
						that.$message({
							message: '修改成功！',
							type: 'success'
						});
						that.getList()
					});
				
				}).catch(() => {
					that.$message({
						type: 'info',
						message: '已取消删除'
					});
				});
				
			},

			//新增用户
			submitForm_add() {
				console.log("新增记录", this.addform)
                let that = this
				if (that.flagtype == 1) {
		
					userAdd(that.addform).then(res => {
						console.log("新增", res)
						that.dialogVisible = false
						if (res.code == 0) {
							that.$message({
								message: '新增成功！',
								type: 'success'
							});
							that.getList()
						}

						// this.tableData = res.list;
						// this.pageTotal = res.pageTotal || 50;
					});
				} else {
					userEdict(that.user_id, that.addform).then(res => {
						console.log("修改", res)
						that.dialogVisible = false
						if (res.code == 0) {
							
							that.$message({
								message: '修改成功！',
								type: 'success'
							});
							that.getList()
						}
					});
					
					
				}


			},
			getList() {
				let that = this
				let query = that.form
				console.log('参数', that.form)
				console.log(query)
				userList(query).then(res => {
					console.log("公告", res);
					that.tableData = res.results;
					that.pageTotal = res.count
				});
			},
			getUser(){
				let that = this
				let query={
					page:1,
					size:99999
				}
				userList(query).then(res => {
					
					that.userList_1 = res.results;
					console.log("个人中心111", that.userList_1);
				});
			},
			formatTen(num) {
				return num > 9 ? (num + "") : ("0" + num);
			},
			formatDate(date) {
				console.log("时间", date)
				var date = new Date(date)
				var year = date.getFullYear();
				var month = date.getMonth() + 1;
				var day = date.getDate();
				var hour = date.getHours();
				var minute = date.getMinutes();
				var second = date.getSeconds();

				return year + "-" + this.formatTen(month) + "-" + this.formatTen(
					day) + " " + this.formatTen(hour) + ":" +this.formatTen(minute) //+ ":" + this.formatTen(second);
								console.log(333, year + "-" + this.formatTen(month) + "-" + this.formatTen(day))
			},
			changeDate() {
				const now = new Date().getTime();
				this.data.forEach((item, index) => {
					const date = new Date(now - (6 - index) * 86400000);
					item.name = `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
				});
			}

		}
	};
</script>


<style lang="scss" scoped>
	 .el-tree /deep/ .el-tree-node {
		.is-leaf + .el-checkbox .el-checkbox__inner {
			display:inline-block;
		}
		.el-checkbox__input> .el-checkbox__inner {
			// display:none;
		}
		.is-leaf.el-tree-node_expand-icon {
			// display:none;
		}
		.is-focusable{
			float: left;
			margin-top: 10px;
		}
	}
	/deep/ .el-pagination__sizes {
		display: none !important;
	}

	/deep/ .el-upload--text {
		width: inherit !important;
		height: inherit !important;
	}

	.edict_row_title {
		width: 100%;
		height: 80px;
		line-height: 100px;
		margin: auto;
		font-weight: bold;
	}

	.avatar-uploader .el-upload {
		border: 1px dashed #d9d9d9;
		border-radius: 6px;
		cursor: pointer;
		position: relative;
		overflow: hidden;
	}

	.avatar-uploader .el-upload:hover {
		border-color: #409eff;
	}

	.avatar-uploader-icon {
		font-size: 28px;
		color: #8c939d;
		width: 178px;
		height: 178px;
		line-height: 178px;
		text-align: center;
	}

	.avatar {
		width: 178px;
		height: 178px;
		display: block;
	}

	.header_bottom {
		/* width: 300px; */
	}

	.header_bottom /deep/ .el-tabs__content {
		display: none;
	}

	.headercon {
		height: 50px;
		/* margin-top: 20px; */
		margin-bottom: 20px;
		border-bottom: 1px solid #369AFF;
	}

	.el-upload {
		width: 100px;
	}

	.el-row {
		margin-bottom: 20px;
	}

	.grid-content {
		display: flex;
		align-items: center;
		height: 40px;
	}

	.grid-cont-right {
		flex: 1;
		text-align: center;
		font-size: 14px;
		color: #999;
	}

	.grid-num {
		font-size: 30px;
		font-weight: bold;
	}

	.grid-con-icon {
		font-size: 50px;
		width: 100px;
		height: 100px;
		text-align: center;
		line-height: 100px;
		color: #fff;
	}

	.grid-con-1 .grid-con-icon {
		background: rgb(45, 140, 240);
	}

	.grid-con-1 .grid-num {
		color: rgb(45, 140, 240);
	}

	.grid-con-2 .grid-con-icon {
		background: rgb(100, 213, 114);
	}

	.grid-con-2 .grid-num {
		color: rgb(45, 140, 240);
	}

	.grid-con-3 .grid-con-icon {
		background: rgb(242, 94, 67);
	}

	.grid-con-3 .grid-num {
		color: rgb(242, 94, 67);
	}

	.user-info {
		display: flex;
		align-items: center;
		padding-bottom: 20px;
		border-bottom: 2px solid #ccc;
		margin-bottom: 20px;
	}

	.user-avator {
		width: 120px;
		height: 120px;
		border-radius: 50%;
	}

	.user-info-cont {
		padding-left: 50px;
		flex: 1;
		font-size: 14px;
		color: #999;
	}

	.user-info-cont div:first-child {
		font-size: 30px;
		color: #222;
	}

	.user-info-list {
		font-size: 14px;
		color: #999;
		line-height: 25px;
	}

	.user-info-list span {
		margin-left: 70px;
	}

	.mgb20 {
		margin-bottom: 20px;
	}

	.todo-item {
		font-size: 14px;
	}

	.todo-item-del {
		text-decoration: line-through;
		color: #999;
	}

	.schart {
		width: 100%;
		height: 300px;
	}

	.delete {
		color: red;
	}

	.dialog-footer {
		text-align: right;
	}
</style>
